import { IResponse } from "@/http/axios/modules"
import { ajaxDel, ajaxGet, ajaxPut } from "@/http/axios/request"
import { IDepartmentList, IEmployeeList } from "@/modules/management/department"

// 所有部门列表
export const getDepartmentList = ():Promise<IResponse<IDepartmentList[]>> => {
    return ajaxGet('/admin/department/lists')
}

// 添加部门
export const addDepartment = (data: { department_name: string, parent_id: string }) => {
    return ajaxGet('/admin/department/addDepartment', data)
}

// 所在部门列表
export const checkOneDepartment = (data: { department_id: string, page: string }): Promise<IResponse<IEmployeeList[]>> => {
    return ajaxGet('/admin/admin/listsDepartment', data)
}

export const updateDepartment = (data: { department_name: string, parent_id: string, department_id: number }) => {
    return ajaxPut('/admin/department/editDepartment', data)
}

export const delDepartment = (data: { department_id: number }) => {
    return ajaxDel('/admin/department/delDepartment', data)
}